

package examples.basic;

import commandz.cli.*;
import java.util.Collection;


/**
 *  An ExitCommand lets the user exit the application.
 */
public class ExitCommand implements Command
{
    private final String COMMAND_NAME = "exit";
    private final String COMMAND_DESCRIPTION = "Terminates this fantastic Example-application.";
        
    protected Example application;

    /**
     *  Initializes a new ExitCommand for use with the given Example.
     *
     *  @param application The Example-application to use.
     */
    public ExitCommand(final Example application)
    {
        this.application = application;
    }


    public String getName()
    {
        return this.COMMAND_NAME;
    }


    public String getDescription()
    {
        return this.COMMAND_DESCRIPTION;
    }


    public void publishParameters(Collection<Parameter> params)
    {
        // This Command provides no parameters.
    }


    public void execute()
    {
        System.out.println("There you go..");
        this.application.stop();
    }
}
